<?php $this->widget('bootstrap.widgets.TbBreadcrumbs', array(
    'links'=>array('Kegiatan'),
));

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
    $('.search-form').slideToggle('fast');
    return false;
});
$('.search-form form').submit(function(){
    $.fn.yiiGridView.update('kegiatan-grid', {
        data: $(this).serialize()
    });
    return false;
});
");

?>

<br />
<h4>Kelola Kegiatan</h4>
<hr />

<?php 
$this->beginWidget('zii.widgets.CPortlet', array(
	'htmlOptions'=>array(
		'class'=>''
	)
));
$this->widget('bootstrap.widgets.TbMenu', array(
	'type'=>'pills',
	'items'=>array(
		array('label'=>'Tambah', 'icon'=>'icon-plus', 'url'=>Yii::app()->controller->createUrl('create'), 'linkOptions'=>array()),
        //        array('label'=>'List', 'icon'=>'icon-th-list', 'url'=>Yii::app()->controller->createUrl('index'),'active'=>true, 'linkOptions'=>array()),
		//array('label'=>'Search', 'icon'=>'icon-search', 'url'=>'#', 'linkOptions'=>array('class'=>'search-button')),
		//array('label'=>'Export to PDF', 'icon'=>'icon-download', 'url'=>Yii::app()->controller->createUrl('GeneratePdf'), 'linkOptions'=>array('target'=>'_blank'), 'visible'=>true),
		//array('label'=>'Export to Excel', 'icon'=>'icon-download', 'url'=>Yii::app()->controller->createUrl('GenerateExcel'), 'linkOptions'=>array('target'=>'_blank'), 'visible'=>true),
	),
));
$this->endWidget();
?>



<div class="search-form" style="display:none">
<?php
/*
$this->renderPartial('_search',array(
	'model'=>$model,
)); 
*/
?>
</div><!-- search-form -->


<?php $this->widget('bootstrap.widgets.TbGridView',array(
	'id'=>'kegiatan-grid',
	'dataProvider'=>$model->search(),
        'type'=>'striped bordered condensed',
        'template'=>'{summary}{pager}{items}{pager}',
	'columns'=>array(
		'id',
		array(
			'name'=>'id_bidang',
			'value'=>'Bidang::model()->findByPk($data->id_bidang)->nama_bidang',
			),
			'nama_kegiatan',
		array(
			'name'=>'tanggal_kegiatan',
			'value'=>'date("d-m-Y",strtotime($data->tanggal_kegiatan))',
			),	
		array(
			'name'=>'uraian',
			'type'=>'html',
			'value'=>'$data->uraian',
			),		
		array(
			'header'=>'Status',
			'value'=>'$data->posting==0 ? "Belum Posting" : "Sudah Posting"',
			),
       array(
            'class'=>'bootstrap.widgets.TbButtonColumn',
			'template' => '{view} {update} {posting} {delete}',
			'buttons' => array(
			      'view' => array(
					'label'=> 'View',
					'options'=>array(
						'class'=>'btn btn-small view'
					)
				),	
                              'update' => array(
					'label'=> 'Update',
					'options'=>array(
						'class'=>'btn btn-small update'
					)
				),
				
				'posting' => array(
					'label'=> 'Posting',
					'url'=>'Yii::app()->createUrl("admin/kegiatan/posting/id/".$data->id)',
					'icon'=>'ok',
					'options'=>array(
						'class'=>'btn btn-small'
					)
					),	   
                           
				'delete' => array(
					'label'=> 'Delete',
					'options'=>array(
						'class'=>'btn btn-small delete'
					)
				)
				
			),
            'htmlOptions'=>array('style'=>'width: 160px'),
           )
	),
)); ?>

